import { Component } from 'react';

export default class Child extends Component {
  state = {
  }
  componentDidMount () {
  }
  shouldComponentUpdate (nextProps, nextState) {
    if (nextProps.num === this.props.num) {
      return false;
    }
    // 优化组件不必要的渲染
    return true;
  }
  render () {
    console.log("子组件（render）");
    return (
      <div>
        Child: {this.props.num}
      </div>
    )
  }
}